<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>
	.form-group{
		width: 600px;
	}
.wrapper{
    margin-left: -140px;
   
}
</style>


</head>
<body>
<section id="container">
<!--header start-->

<!--header end-->
<!--sidebar start-->
<aside>

</aside>



<section id="main-content">
	<section class="wrapper">
		<div class="table-agile-info">
  <div class="panel panel-default">
    <div class="panel-heading">
     创建任务
    </div>
   
    <div class="container">
     
     
        <div class="form-group">
        
		<div class="form-group">
		  <label for="text">任务标题:</label>
		  <input type="text" class="form-control" id="t" placeholder="Enter email">
		
		</div>
		<div class="form-group">
			<label for="text">优先级</label>
			<select id="aq">
			<option>缓</option>
			<option>急</option>
			   </select>
			   <label for="text">执行人</label>
			   <select id="as">
			
			   </select>
		</div>
		       
		<div class="form-group">
		  <label for="email">计划开始时间:</label>
		  <input type="date" class="form-control" id="k" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">计划结束时间:</label>
		  <input type="date" class="form-control" id="j" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">任务说明:</label>
		  <input type="text" class="form-control" id="r" placeholder="Enter email">
		</div>
		<div class="form-group">
		  <label for="email">工期:</label>
		  <input type="number" class="form-control" id="g" placeholder="Enter email">
		</div>
       
        <button type="button" class="btn btn-primary" onClick="addt()">添加</button>
     
    </div>
</div>
</section>     
<!--sidebar end-->
<!--main content start-->

		
 <!-- footer -->
		 
  <!-- / footer -->
</section>

<!--main content end-->
</section>
<script src="js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
ad();
function ad(){
	$.ajax({
  	  type:"post",
  	  url:"pall",
  	  data:{},
  	  success:function(data){
  		  var s=""
  		  console.log(data);
  		  for (var i = 0; i < data.length; i++) {
  			  s+="<option value='"+data[i].pId+"'>"+data[i].pName+"</option>"
  		  }
  		  $("#as").empty().append(s); 
  	  }
    })
}
function addt(){
	var title=$("#t").val();
	var y=$("#aq").find("option:selected").text();
	var m=$("#as").val(); 
	var k=$("#k").val();
	var j=$("#j").val();
	var r=$("#r").val();
	var g=$("#g").val();
	 console.log(y);
	var task={
			tTiele:title,
			tTime:k,
			tMan:m,
			tExplain:r,
			tRelationship:g,
			tEndtime:j,
			tPriority:y,
			tuId:1
	}
	console.log(task);
	$.ajax({
		type:"post",
		url:"add",
		 data:JSON.stringify(task),
			contentType:"application/json;charset=utf-8",
		success:function(data){
			if(data.status=="success"){
				alert("添加成功");
				
				
			}else{
				alert("添加失败");
			}
		}
	})
	
}
</script>
</body>
</html>